import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/user/login.vue'
import home from '../views/home/home.vue'
import qa from '../views/qa/qa.vue'
import movie from '../views/movie/movie.vue'
import notfound from '../views/notfound/notfound.vue'
import user from '../views/user/user.vue'
import edit from '../views/user/edit.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/edit',
    name: 'edit',
    component: edit
  },
  {
    // 这里的路径一般用/
    path: '/home',
    name: 'home',
    component: home,
    meta: {
      showTab: true
    }
  },
  {
    // 这里的路径一般用/
    path: '/movie',
    name: 'movie',
    component: movie,
    meta: {
      showTab: true
    }
  },
  {
    // 这里的路径一般用/
    path: '/qa',
    name: 'qa',
    component: qa,
    meta: {
      showTab: true
    }
  },

  {
    // 这里的路径一般用/
    path: '/user',
    name: 'user',
    component: user,
    meta: {
      showTab: true
    }
  },

  // 配置错误路径
  {
    path: '/notfound',
    name: 'notfound',
    component: notfound
  },
  ,
  // 路由重定向
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '*',
    redirect: '/notfound'
  }
]

const router = new VueRouter({
  routes
})

export default router
